package com.xayy.health.core.enums;

import lombok.Getter;

/**
 * 任务运行状态枚举
 *
 * @author houchengwei
 * createTime 2023/2/20
 * @version V1.0
 */
public enum TaskStatusEnum {
    //运行中
    RUNNING(1, "运行中"),
    //完成
    DONE(2, "完成"),
    //异常
    ABNORMAL(3, "异常"),
    //删除
    DELETE(4, "删除");

    @Getter
    private Integer code;

    @Getter
    private String name;

    TaskStatusEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public static String valueof(Integer index) {
        for (TaskStatusEnum relationTypeEnum : values()) {
            if (relationTypeEnum.getCode().equals(index)) {
                return relationTypeEnum.name;
            }
        }
        return "";
    }
}
